package com.yanqu.road.server.cmd.cricket;

import com.google.protobuf.InvalidProtocolBufferException;
import com.yanqu.road.pb.cricket.CricketProto;
import com.yanqu.road.pb.syncMessage.SyncMessage;
import com.yanqu.road.server.game.service.IGameServiceCommand;
import com.yanqu.road.server.gameplayer.module.cricket.CricketMgr;
import com.yanqu.road.sync.message.SyncResponse;

public class CricketWatchUserServiceCmd implements IGameServiceCommand {

    @Override
    public SyncResponse execute(SyncMessage.Request request) throws InvalidProtocolBufferException {
        SyncResponse syncResponse = new SyncResponse();
        CricketProto.CricketWatchPlayerSimpleReqMsg reqMsg = CricketProto.CricketWatchPlayerSimpleReqMsg.parseFrom(request.getDataBytes());
        CricketProto.CricketWatchPlayerSimpleRespMsg.Builder builder = CricketMgr.watch(reqMsg.getUserId());
        syncResponse.setResponseBuilder(builder);
        return syncResponse;
    }
}
